import 'package:seedfour/generated/json/base/json_convert_content.dart';
import 'package:seedfour/app/models/notice_v2_entity.dart';

NoticeV2Entity $NoticeV2EntityFromJson(Map<String, dynamic> json) {
  final NoticeV2Entity noticeV2Entity = NoticeV2Entity();
  final int? createdAt = jsonConvert.convert<int>(json['createdAt']);
  if (createdAt != null) {
    noticeV2Entity.createdAt = createdAt;
  }
  final int? updatedAt = jsonConvert.convert<int>(json['updatedAt']);
  if (updatedAt != null) {
    noticeV2Entity.updatedAt = updatedAt;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    noticeV2Entity.id = id;
  }
  final String? uid = jsonConvert.convert<String>(json['uid']);
  if (uid != null) {
    noticeV2Entity.uid = uid;
  }
  final String? orgId = jsonConvert.convert<String>(json['orgId']);
  if (orgId != null) {
    noticeV2Entity.orgId = orgId;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    noticeV2Entity.name = name;
  }
  final String? target = jsonConvert.convert<String>(json['target']);
  if (target != null) {
    noticeV2Entity.target = target;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    noticeV2Entity.type = type;
  }
  final int? shareType = jsonConvert.convert<int>(json['shareType']);
  if (shareType != null) {
    noticeV2Entity.shareType = shareType;
  }
  final int? quota = jsonConvert.convert<int>(json['quota']);
  if (quota != null) {
    noticeV2Entity.quota = quota;
  }
  final int? needQuota = jsonConvert.convert<int>(json['needQuota']);
  if (needQuota != null) {
    noticeV2Entity.needQuota = needQuota;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    noticeV2Entity.title = title;
  }
  final String? content = jsonConvert.convert<String>(json['content']);
  if (content != null) {
    noticeV2Entity.content = content;
  }
  final String? phoneNumber = jsonConvert.convert<String>(json['phoneNumber']);
  if (phoneNumber != null) {
    noticeV2Entity.phoneNumber = phoneNumber;
  }
  final String? subjectAmount = jsonConvert.convert<String>(
      json['subjectAmount']);
  if (subjectAmount != null) {
    noticeV2Entity.subjectAmount = subjectAmount;
  }
  final String? servicePrice = jsonConvert.convert<String>(
      json['servicePrice']);
  if (servicePrice != null) {
    noticeV2Entity.servicePrice = servicePrice;
  }
  final int? refreshAt = jsonConvert.convert<int>(json['refreshAt']);
  if (refreshAt != null) {
    noticeV2Entity.refreshAt = refreshAt;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    noticeV2Entity.status = status;
  }
  final String? catalog = jsonConvert.convert<String>(json['catalog']);
  if (catalog != null) {
    noticeV2Entity.catalog = catalog;
  }
  final int? cooperRatio = jsonConvert.convert<int>(json['cooperRatio']);
  if (cooperRatio != null) {
    noticeV2Entity.cooperRatio = cooperRatio;
  }
  final String? ownerMobile = jsonConvert.convert<String>(json['ownerMobile']);
  if (ownerMobile != null) {
    noticeV2Entity.ownerMobile = ownerMobile;
  }
  final int? ownerType = jsonConvert.convert<int>(json['ownerType']);
  if (ownerType != null) {
    noticeV2Entity.ownerType = ownerType;
  }
  final String? receiveUid = jsonConvert.convert<String>(json['receiveUid']);
  if (receiveUid != null) {
    noticeV2Entity.receiveUid = receiveUid;
  }
  final String? receiveName = jsonConvert.convert<String>(json['receiveName']);
  if (receiveName != null) {
    noticeV2Entity.receiveName = receiveName;
  }
  final int? receiveTime = jsonConvert.convert<int>(json['receiveTime']);
  if (receiveTime != null) {
    noticeV2Entity.receiveTime = receiveTime;
  }
  final String? receivePhone = jsonConvert.convert<String>(
      json['receivePhone']);
  if (receivePhone != null) {
    noticeV2Entity.receivePhone = receivePhone;
  }
  final String? caseId = jsonConvert.convert<String>(json['caseId']);
  if (caseId != null) {
    noticeV2Entity.caseId = caseId;
  }
  final String? caseName = jsonConvert.convert<String>(json['caseName']);
  if (caseName != null) {
    noticeV2Entity.caseName = caseName;
  }
  final int? ownerContact = jsonConvert.convert<int>(json['ownerContact']);
  if (ownerContact != null) {
    noticeV2Entity.ownerContact = ownerContact;
  }
  final bool? isOwner = jsonConvert.convert<bool>(json['isOwner']);
  if (isOwner != null) {
    noticeV2Entity.isOwner = isOwner;
  }
  final bool? isTaker = jsonConvert.convert<bool>(json['isTaker']);
  if (isTaker != null) {
    noticeV2Entity.isTaker = isTaker;
  }
  final bool? isMan = jsonConvert.convert<bool>(json['isMan']);
  if (isMan != null) {
    noticeV2Entity.isMan = isMan;
  }
  final List<NoticeV2Attaches>? attaches = (json['attaches'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<NoticeV2Attaches>(e) as NoticeV2Attaches)
      .toList();
  if (attaches != null) {
    noticeV2Entity.attaches = attaches;
  }
  final List<NoticeV2History>? history = (json['history'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<NoticeV2History>(e) as NoticeV2History)
      .toList();
  if (history != null) {
    noticeV2Entity.history = history;
  }
  return noticeV2Entity;
}

Map<String, dynamic> $NoticeV2EntityToJson(NoticeV2Entity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createdAt'] = entity.createdAt;
  data['updatedAt'] = entity.updatedAt;
  data['id'] = entity.id;
  data['uid'] = entity.uid;
  data['orgId'] = entity.orgId;
  data['name'] = entity.name;
  data['target'] = entity.target;
  data['type'] = entity.type;
  data['shareType'] = entity.shareType;
  data['quota'] = entity.quota;
  data['needQuota'] = entity.needQuota;
  data['title'] = entity.title;
  data['content'] = entity.content;
  data['phoneNumber'] = entity.phoneNumber;
  data['subjectAmount'] = entity.subjectAmount;
  data['servicePrice'] = entity.servicePrice;
  data['refreshAt'] = entity.refreshAt;
  data['status'] = entity.status;
  data['catalog'] = entity.catalog;
  data['cooperRatio'] = entity.cooperRatio;
  data['ownerMobile'] = entity.ownerMobile;
  data['ownerType'] = entity.ownerType;
  data['receiveUid'] = entity.receiveUid;
  data['receiveName'] = entity.receiveName;
  data['receiveTime'] = entity.receiveTime;
  data['receivePhone'] = entity.receivePhone;
  data['caseId'] = entity.caseId;
  data['caseName'] = entity.caseName;
  data['ownerContact'] = entity.ownerContact;
  data['isOwner'] = entity.isOwner;
  data['isTaker'] = entity.isTaker;
  data['isMan'] = entity.isMan;
  data['attaches'] = entity.attaches?.map((v) => v.toJson()).toList();
  data['history'] = entity.history?.map((v) => v.toJson()).toList();
  return data;
}

extension NoticeV2EntityExtension on NoticeV2Entity {
  NoticeV2Entity copyWith({
    int? createdAt,
    int? updatedAt,
    int? id,
    String? uid,
    String? orgId,
    String? name,
    String? target,
    int? type,
    int? shareType,
    int? quota,
    int? needQuota,
    String? title,
    String? content,
    String? phoneNumber,
    String? subjectAmount,
    String? servicePrice,
    int? refreshAt,
    int? status,
    String? catalog,
    int? cooperRatio,
    String? ownerMobile,
    int? ownerType,
    String? receiveUid,
    String? receiveName,
    int? receiveTime,
    String? receivePhone,
    String? caseId,
    String? caseName,
    int? ownerContact,
    bool? isOwner,
    bool? isTaker,
    bool? isMan,
    List<NoticeV2Attaches>? attaches,
    List<NoticeV2History>? history,
  }) {
    return NoticeV2Entity()
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..id = id ?? this.id
      ..uid = uid ?? this.uid
      ..orgId = orgId ?? this.orgId
      ..name = name ?? this.name
      ..target = target ?? this.target
      ..type = type ?? this.type
      ..shareType = shareType ?? this.shareType
      ..quota = quota ?? this.quota
      ..needQuota = needQuota ?? this.needQuota
      ..title = title ?? this.title
      ..content = content ?? this.content
      ..phoneNumber = phoneNumber ?? this.phoneNumber
      ..subjectAmount = subjectAmount ?? this.subjectAmount
      ..servicePrice = servicePrice ?? this.servicePrice
      ..refreshAt = refreshAt ?? this.refreshAt
      ..status = status ?? this.status
      ..catalog = catalog ?? this.catalog
      ..cooperRatio = cooperRatio ?? this.cooperRatio
      ..ownerMobile = ownerMobile ?? this.ownerMobile
      ..ownerType = ownerType ?? this.ownerType
      ..receiveUid = receiveUid ?? this.receiveUid
      ..receiveName = receiveName ?? this.receiveName
      ..receiveTime = receiveTime ?? this.receiveTime
      ..receivePhone = receivePhone ?? this.receivePhone
      ..caseId = caseId ?? this.caseId
      ..caseName = caseName ?? this.caseName
      ..ownerContact = ownerContact ?? this.ownerContact
      ..isOwner = isOwner ?? this.isOwner
      ..isTaker = isTaker ?? this.isTaker
      ..isMan = isMan ?? this.isMan
      ..attaches = attaches ?? this.attaches
      ..history = history ?? this.history;
  }
}

NoticeV2Attaches $NoticeV2AttachesFromJson(Map<String, dynamic> json) {
  final NoticeV2Attaches noticeV2Attaches = NoticeV2Attaches();
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    noticeV2Attaches.name = name;
  }
  final String? url = jsonConvert.convert<String>(json['url']);
  if (url != null) {
    noticeV2Attaches.url = url;
  }
  return noticeV2Attaches;
}

Map<String, dynamic> $NoticeV2AttachesToJson(NoticeV2Attaches entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['name'] = entity.name;
  data['url'] = entity.url;
  return data;
}

extension NoticeV2AttachesExtension on NoticeV2Attaches {
  NoticeV2Attaches copyWith({
    String? name,
    String? url,
  }) {
    return NoticeV2Attaches()
      ..name = name ?? this.name
      ..url = url ?? this.url;
  }
}

NoticeV2History $NoticeV2HistoryFromJson(Map<String, dynamic> json) {
  final NoticeV2History noticeV2History = NoticeV2History();
  final int? createdAt = jsonConvert.convert<int>(json['createdAt']);
  if (createdAt != null) {
    noticeV2History.createdAt = createdAt;
  }
  final int? updatedAt = jsonConvert.convert<int>(json['updatedAt']);
  if (updatedAt != null) {
    noticeV2History.updatedAt = updatedAt;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    noticeV2History.id = id;
  }
  final String? orgId = jsonConvert.convert<String>(json['orgId']);
  if (orgId != null) {
    noticeV2History.orgId = orgId;
  }
  final int? noticeId = jsonConvert.convert<int>(json['noticeId']);
  if (noticeId != null) {
    noticeV2History.noticeId = noticeId;
  }
  final String? caseId = jsonConvert.convert<String>(json['caseId']);
  if (caseId != null) {
    noticeV2History.caseId = caseId;
  }
  final String? caseName = jsonConvert.convert<String>(json['caseName']);
  if (caseName != null) {
    noticeV2History.caseName = caseName;
  }
  final String? uid = jsonConvert.convert<String>(json['uid']);
  if (uid != null) {
    noticeV2History.uid = uid;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    noticeV2History.type = type;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    noticeV2History.name = name;
  }
  final int? quota = jsonConvert.convert<int>(json['quota']);
  if (quota != null) {
    noticeV2History.quota = quota;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    noticeV2History.remark = remark;
  }
  return noticeV2History;
}

Map<String, dynamic> $NoticeV2HistoryToJson(NoticeV2History entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createdAt'] = entity.createdAt;
  data['updatedAt'] = entity.updatedAt;
  data['id'] = entity.id;
  data['orgId'] = entity.orgId;
  data['noticeId'] = entity.noticeId;
  data['caseId'] = entity.caseId;
  data['caseName'] = entity.caseName;
  data['uid'] = entity.uid;
  data['type'] = entity.type;
  data['name'] = entity.name;
  data['quota'] = entity.quota;
  data['remark'] = entity.remark;
  return data;
}

extension NoticeV2HistoryExtension on NoticeV2History {
  NoticeV2History copyWith({
    int? createdAt,
    int? updatedAt,
    int? id,
    String? orgId,
    int? noticeId,
    String? caseId,
    String? caseName,
    String? uid,
    int? type,
    String? name,
    int? quota,
    String? remark,
  }) {
    return NoticeV2History()
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..id = id ?? this.id
      ..orgId = orgId ?? this.orgId
      ..noticeId = noticeId ?? this.noticeId
      ..caseId = caseId ?? this.caseId
      ..caseName = caseName ?? this.caseName
      ..uid = uid ?? this.uid
      ..type = type ?? this.type
      ..name = name ?? this.name
      ..quota = quota ?? this.quota
      ..remark = remark ?? this.remark;
  }
}